home *** CD-ROM | disk | FTP | other *** search
- // mainfrm.cpp : implementation of the CHtmlFrame class
- //
-
-
- #include "stdafx.h"
- #include "htmlfrm.h"
- #include "resource.h"
-
- #include "HTMLHelp.h"
-
-
- IMPLEMENT_DYNCREATE(CHtmlFrame, CMDIFrameWnd)
- BEGIN_MESSAGE_MAP(CHtmlFrame, CMDIFrameWnd)
- //{{AFX_MSG_MAP(CHtmlFrame)
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- static UINT BASED_CODE buttons[] =
- {
- // same order as in the bitmap 'toolbar.bmp'
- ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, 0,
- ID_EDIT_CUT, ID_EDIT_COPY, ID_EDIT_PASTE, 0,
- ID_FILE_PRINT, ID_APP_ABOUT,
- };
-
- static UINT BASED_CODE indicators[] =
- {
- 0, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL,
- };
-
- int CHtmlFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- /*
- if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
- | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
- !m_wndToolBar.LoadToolBar(IDR_HELPFRM))
- {
- TRACE0("Failed to create toolbar\n");
- return -1; // fail to create
- }
- */
-
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status bar\n");
- return -1; // fail to create
- }
-
- // TODO: Delete these three lines if you don't want the toolbar to
- // be dockable
- /*
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_wndToolBar);
- */
-
- CHTMLHelp foo;
- RECT toto;
- toto.bottom=toto.right=0;
- toto.top=toto.left=600;
- foo.Create(NULL,NULL,WS_CHILD,toto,this,0);
- //SetActiveView(&foo);
-
- return 0;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Helpers for saving/restoring window state
-
- static TCHAR BASED_CODE szSection[] = _T("Settings");
- static TCHAR BASED_CODE szWindowPos[] = _T("WindowPos");
- static TCHAR szFormat[] = _T("%u,%u,%d,%d,%d,%d,%d,%d,%d,%d");
-
- static BOOL PASCAL NEAR ReadWindowPlacement(LPWINDOWPLACEMENT pwp)
- {
- CString strBuffer = AfxGetApp()->GetProfileString(szSection, szWindowPos);
- if (strBuffer.IsEmpty())
- return FALSE;
-
- WINDOWPLACEMENT wp;
- int nRead = _stscanf(strBuffer, szFormat,
- &wp.flags, &wp.showCmd,
- &wp.ptMinPosition.x, &wp.ptMinPosition.y,
- &wp.ptMaxPosition.x, &wp.ptMaxPosition.y,
- &wp.rcNormalPosition.left, &wp.rcNormalPosition.top,
- &wp.rcNormalPosition.right, &wp.rcNormalPosition.bottom);
-
- if (nRead != 10)
- return FALSE;
-
- wp.length = sizeof wp;
- *pwp = wp;
- return TRUE;
- }
-
- static void PASCAL NEAR WriteWindowPlacement(LPWINDOWPLACEMENT pwp)
- // write a window placement to settings section of app's ini file
- {
- TCHAR szBuffer[sizeof("-32767")*8 + sizeof("65535")*2];
-
- wsprintf(szBuffer, szFormat,
- pwp->flags, pwp->showCmd,
- pwp->ptMinPosition.x, pwp->ptMinPosition.y,
- pwp->ptMaxPosition.x, pwp->ptMaxPosition.y,
- pwp->rcNormalPosition.left, pwp->rcNormalPosition.top,
- pwp->rcNormalPosition.right, pwp->rcNormalPosition.bottom);
- AfxGetApp()->WriteProfileString(szSection, szWindowPos, szBuffer);
- }
-
-